﻿<%@ Page Language="C#" MasterPageFile="/_layouts/NintexWorkflow/ActivityUIMasterPage.master" AutoEventWireup="true" CodeBehind="NWPOWERSHELLDialog.aspx.cs" Inherits="NPPTEC.NWPOWERSHELL.NWPOWERSHELLDialog, NPPTEC.NWPOWERSHELL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=75b10329cd4eef56" EnableEventValidation="false"%>
<asp:Content ID="ContentHeader" ContentPlaceHolderID="AdditionalPageHeader" runat="server">

<%@ Register Assembly="Nintex.Workflow.ServerControls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=913f6bae0ca5ae12" Namespace="Nintex.Workflow.ServerControls" TagPrefix="Nintex" %>
<%@ Register TagPrefix="Nintex" TagName="ReferenceTextFieldWebControl" src="~/_layouts/NintexWorkflow/ReferenceTextFieldWebControl.ascx" %>
<%@ Assembly Name="Nintex.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=913f6bae0ca5ae12" %>
<%@ Register TagPrefix="Nintex" TagName="SitePickerTreeViewLinkControl" Src="~/_layouts/NintexWorkflow/SitePickerTreeViewLinkControl.ascx" %>
 <script type="text/javascript" language="javascript">

 var PowerShellInputCtrl;
    var PowerShellOutputCtrl;

    function TPARetrieveConfig()
    {
PowerShellInputCtrl = document.getElementById("powershellinput");
PowerShellOutputCtrl=document.getElementById("powershelloutput");
          var workflowVariables = ListWorkflowVariables();

        for(var i=0; i<workflowVariables.length; i++)
        {
            if(workflowVariables[i].getAttribute("Type") == "Text"){
             PowerShellInputCtrl.options[PowerShellInputCtrl.options.length] = new Option(workflowVariables[i].getAttribute("Name"), workflowVariables[i].getAttribute("Name"));
             PowerShellOutputCtrl.options[PowerShellOutputCtrl.options.length] = new Option(workflowVariables[i].getAttribute("Name"), workflowVariables[i].getAttribute("Name"));}
        }
          
        PowerShellInputCtrl.value = configXml.selectSingleNode("/NWActionConfig/Parameters/Parameter[@Name='powershellinput']/Variable/@Name").text;
        PowerShellOutputCtrl.value = configXml.selectSingleNode("/NWActionConfig/Parameters/Parameter[@Name='powershelloutput']/Variable/@Name").text;
     
    }

    function TPAWriteConfig()
    {
 if(PowerShellInputCtrl.selectedIndex > -1)
 configXml.selectSingleNode("/NWActionConfig/Parameters/Parameter[@Name='powershellinput']/Variable/@Name").text = PowerShellInputCtrl.options[PowerShellInputCtrl.selectedIndex].value;
 
 if(PowerShellOutputCtrl.selectedIndex > -1)
 configXml.selectSingleNode("/NWActionConfig/Parameters/Parameter[@Name='powershelloutput']/Variable/@Name").text = PowerShellOutputCtrl.options[PowerShellOutputCtrl.selectedIndex].value;
 
 return true;
    }
    </script>
</asp:Content>

<asp:Content ID="ContentBody" ContentPlaceHolderID="NintexPropertyPlaceHolder" runat="Server">
<div class="RowBlue"> 
<span class="Label req">Скрипт</span>
<select class="InputWidth" id="powershellinput" ></select>
</div>
<div class="RowBlue"> 
<span class="Label req">Результат выполнения</span>
<select  class="InputWidth" id="powershelloutput"></select>
</asp:Content>
